package com.yh.ssm.controller;

import java.util.Map;

import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;

import com.opensymphony.xwork2.ActionInvocation;
import com.opensymphony.xwork2.interceptor.MethodFilterInterceptor;
import com.yh.ssm.test.Ptest;

public class MethodInterceptor extends MethodFilterInterceptor {

	private static Logger logger = LogManager.getLogger(MethodInterceptor.class);

	@Override
	protected String doIntercept(ActionInvocation invocation) throws Exception {

//		System.out.println("0000000000000000000");
//		Map<String,Object> session=invocation.getInvocationContext().getSession();
		
//		System.out.println(session);
	//	System.out.println(session.get("name"));
		logger.info("客户登录验证。。。。");
		if(invocation.getInvocationContext().getSession().get("name")==null){
			return "log";
		}
		
		String in=invocation.invoke();
		logger.info("客户登录验证结束。。。。");
		
		return in;
	}

}
